package com.ra.landlord;

import java.io.File;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 * 品牌公寓实体
 * 
 * @author colin
 * 
 */
@Entity
@Table(name = "ra_blandapartment")
public class BlandApartment implements LandlordOwner {

	/** 品牌公寓Id */
	private Integer id;

	/** 品牌公寓名称 */
	private String baName;

	/** 品牌公寓积分(用于排序) */
	private Long score;

	/** 品牌公寓图标路径 */
	private String baLogo;
	private String baLogoNameContentType;
	private File baLogoNameFile;

	/** 品牌公寓Banner图片路径 */
	private List<BlandApartmentBanner> blandApartmentBanners;

	/** 品牌公寓特色服务图片路径 */
	private BcCharactServiceItemInfo bcCharactServiceItemInfo;

	/** 品牌公寓推广房屋图片图片路径 */
	private List<Promotehouse> promotehouses;

	/** 所属人 */
	private LandlordOwnerUser landlordUser;

	 /** 创建人 */
	private LandlordUser createUser;

	@Id
	@GeneratedValue
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getBaName() {
		return baName;
	}

	public void setBaName(String baName) {
		this.baName = baName;
	}

	public String getBaLogo() {
		return baLogo;
	}

	public void setBaLogo(String baLogo) {
		this.baLogo = baLogo;
	}

	@Transient
	public String getBaLogoNameContentType() {
		return baLogoNameContentType;
	}

	public void setBaLogoNameContentType(String baLogoNameContentType) {
		this.baLogoNameContentType = baLogoNameContentType;
	}

	@Transient
	public File getBaLogoNameFile() {
		return baLogoNameFile;
	}

	public void setBaLogoNameFile(File baLogoNameFile) {
		this.baLogoNameFile = baLogoNameFile;
	}

	@OneToMany(mappedBy = "blandApartment", orphanRemoval = true, cascade = CascadeType.ALL, fetch = FetchType.LAZY, targetEntity = BlandApartmentBanner.class)
	public List<BlandApartmentBanner> getBlandApartmentBanners() {
		return blandApartmentBanners;
	}

	public void setBlandApartmentBanners(
			List<BlandApartmentBanner> blandApartmentBanners) {
		this.blandApartmentBanners = blandApartmentBanners;
	}

	@OneToOne(mappedBy = "blandApartment")
	public BcCharactServiceItemInfo getBcCharactServiceItemInfo() {
		return bcCharactServiceItemInfo;
	}

	public void setBcCharactServiceItemInfo(
			BcCharactServiceItemInfo bcCharactServiceItemInfo) {
		this.bcCharactServiceItemInfo = bcCharactServiceItemInfo;
	}

	@OneToMany(mappedBy = "blandApartment", orphanRemoval = true, cascade = CascadeType.ALL, fetch = FetchType.LAZY, targetEntity = Promotehouse.class)
	public List<Promotehouse> getPromotehouses() {
		return promotehouses;
	}

	public void setPromotehouses(List<Promotehouse> promotehouses) {
		this.promotehouses = promotehouses;
	}

	public Long getScore() {
		return score;
	}

	public void setScore(Long score) {
		this.score = score;
	}

	@Override 
	@ManyToOne(fetch=FetchType.LAZY)
	public LandlordOwnerUser getLandlordUser() {
		return this.landlordUser;
	}

	@Override
	public void setLandlordUser(LandlordOwnerUser landlordUser) {
		this.landlordUser = landlordUser;
	}

	@ManyToOne(fetch=FetchType.LAZY)
	public LandlordUser getCreateUser() {
		return createUser;
	}

	public void setCreateUser(LandlordUser createUser) {
		this.createUser = createUser;
	}

}